def swap(arr):
    max_index = 0
    min_index = 0
    max = arr[0]
    min = arr[0]
    for item in range(len(arr)):
        if max<arr[item]:
            max = arr[item]
            max_index = item
        if min > arr[item]:
            min = arr[item]
            min_index = item
    max,arr[0] = arr[0],max
    min,arr[len(arr)-1] = arr[len(arr)-1],min
    return arr
if __name__ =="__main__":
    arr = [1,2,3,4,5,6,7,8,9]
	print 'brfore change: ',arr
	print 'after change: ',swap(arr)